package com.example.SpringModelManage.service;

import com.example.SpringModelManage.entity.Dataset;
import com.example.SpringModelManage.entity.Model;
import com.example.SpringModelManage.mapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Class Description
 *
 * @author hulilei
 * @version 1.0.0
 * @date 2021/10/24 16:07
 */
@Service
public class ModelServiceImpl implements ModelService {
    @Autowired
    private ModelMapper modelMapper;

    @Override
    public Model selectModelById(String modelId) {
        return modelMapper.selectByModelId(modelId);
    }

    @Override
    public List<Model> getModelByLimit(String developId, Integer startIndex, Integer pageSize) {
        return modelMapper.getModelByLimit(developId, startIndex, pageSize);
    }

    @Override
    public List<Model> getModelByLimitSearch(String developId, String modelId, String modelName, String modelVersion, String modelType,
                                             String modelStatus, Integer startIndex, Integer pageSize) {
        return modelMapper.getModelByLimitSearch(developId, modelId, modelName, modelVersion, modelType, modelStatus, startIndex, pageSize);
    }

    @Override
    public void createModel(String developId, String modelId, String umId, String modelName, String modelType, String modelLanguage,
                            String modelDescribe, String modelCreateTime, String modelVersion, String modelStatus) {
        modelMapper.createModel(developId, modelId, umId, modelName, modelType, modelLanguage, modelDescribe,
                modelCreateTime, modelVersion, modelStatus);
    }

    @Override
    public List<Model> getModelNameByDevelopId(String developId, String modelStatus) {
        return modelMapper.getModelNameByDevelopId(developId, modelStatus);
    }

    @Override
    public void uploadModel(String modelId, String datasetId, String mdId, String modelStatus, String modelFilePath, String modelRequirementPath, String modelSpecificationPath,String modelUploadTime) {
        modelMapper.uploadModel(modelId, datasetId, mdId, modelStatus, modelFilePath, modelRequirementPath, modelSpecificationPath, modelUploadTime);
    }

    @Override
    public double getModelGuidePrice(String modelId) {
        return modelMapper.getModelGuidePrice(modelId);
    }

    @Override
    public void releaseModel(String modelId, String modelPrice, String modelStatus, String modelReleaseTime) {
        modelMapper.releaseModel(modelId, modelPrice, modelStatus, modelReleaseTime);
        return;
    }

    @Override
    public String getModelVersionById(String modelId) {
        return modelMapper.getModelVersionById(modelId);
    }

    @Override
    public void updateModelFile(String developId, String modelId, String modelVersion, String modelFilePath) {
        modelMapper.updateModelFile(developId, modelId, modelVersion, modelFilePath);
    }

    @Override
    public List<String> getDatasetNameByModelId(String modelId) {
        return modelMapper.getDatasetNameByModelId(modelId);
    }

    @Override
    public List<Dataset> getModelDatasetByModelId(String modelId) {
        return modelMapper.getModelDatasetByModelId(modelId);
    }

    @Override
    public void updateModelDataset(String modelId, String modelUpdateTime, String operator, String datasetId, String mdId) {
        modelMapper.updateModelDataset(modelId, modelUpdateTime, operator, datasetId, mdId);
    }

    @Override
    public List<Dataset> getDatasetById(String developId) {
        return modelMapper.getDatasetById(developId);
    }

    @Override
    public List<Dataset> getDatasetByLimitSearch(String developId, String datasetId, String datasetName,
                                                 String datasetType, String datasetVersion, Integer startIndex, Integer pageSize) {
        return modelMapper.getDatasetByLimitSearch(developId, datasetId, datasetName, datasetType, datasetVersion, startIndex, pageSize);
    }

    @Override
    public void uploadDataset(String developId, String datasetId, String datasetName, String datasetVersion,  String datasetUploadTime, String datasetType, String datasetFilePath) {
        modelMapper.uploadDataset(developId, datasetId, datasetName, datasetVersion, datasetUploadTime, datasetType, datasetFilePath);
    }

    @Override
    public void updateDataset(String datasetId, String datasetFilePath, String datasetUpdateTime, String datasetVersion) {
        modelMapper.updateDataset(datasetId, datasetFilePath, datasetUpdateTime, datasetVersion);
    }
}
